/**
 * 初始化检查报告详情对话框
 */
var CdcExaminationInfoDlg = {
    validateFields: {
    	episodeId: {
            validators: {
                notEmpty: {
                    message: '就诊记录不能为空'
                }
            }
        },
    	xcode: {
            validators: {
                notEmpty: {
                    message: '索引码不能为空'
                }
            }
        },
    	examNum: {
            validators: {
                notEmpty: {
                    message: '检查号不能为空'
                }
            }
        },
    	busExamReportStatusId: {
            validators: {
                notEmpty: {
                    message: '状态不能为空'
                }
            }
        },
    	// itemDesc: {
        //     validators: {
        //         notEmpty: {
        //             message: '项目不能为空'
        //         }
        //     }
        // },
        description: {
            validators: {
                notEmpty: {
                    message: '描述不能为空'
                }
            }
        },
    	examDesc: {
            validators: {
                notEmpty: {
                    message: '检查所见不能为空'
                }
            }
        },
    	resultDesc: {
            validators: {
                notEmpty: {
                    message: '诊断意见不能为空'
                }
            }
        },
    	repUserName: {
            validators: {
                notEmpty: {
                    message: '报告人不能为空'
                }
            }
        },
    	repDate: {
            validators: {
                notEmpty: {
                    message: '报告日期不能为空'
                }
            }
        },
    	regUserName: {
            validators: {
                notEmpty: {
                    message: '登记人不能为空'
                }
            }
        },
    	regDate: {
            validators: {
                notEmpty: {
                    message: '登记日期不能为空'
                }
            }
        },
    	dataId: {
            validators: {
                notEmpty: {
                    message: '业务数据类型不能为空'
                }
            }
        },
    	isActive: {
            validators: {
                notEmpty: {
                    message: '是否有效不能为空'
                }
            }
        },
    }
};


/**
 * 关闭此对话框
 */
CdcExaminationInfoDlg.close = function() {
    parent.layer.close(parent.layer.getFrameIndex(window.name)); //先得到当前iframe层的索引,再执行关闭   
}

/**
 * 验证数据是否为空
 */
CdcExaminationInfoDlg.validate = function () {
    $('#cdcExaminationInfoForm').data("bootstrapValidator").resetForm();
    $('#cdcExaminationInfoForm').bootstrapValidator('validate');
    return $("#cdcExaminationInfoForm").data('bootstrapValidator').isValid();
}

/**
 * 提交新增
 */
CdcExaminationInfoDlg.addSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('cdcExaminationInfoForm',Sys.backendPath + "/cdc/cdcexamination/add",function(res) {
        Sys.success(res.message);
    	window.parent.CdcExamination.table.refresh();
        CdcExaminationInfoDlg.close();
    });
}

/**
 * 提交修改
 */
CdcExaminationInfoDlg.editSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('cdcExaminationInfoForm',Sys.backendPath + "/cdc/cdcexamination/update",function(res) {
        Sys.success(res.message);
    	window.parent.CdcExamination.table.refresh();
        CdcExaminationInfoDlg.close();
    });
}

$(function() {
	Sys.initValidator("cdcExaminationInfoForm", CdcExaminationInfoDlg.validateFields);
});
